import 'package:flutter/material.dart';
import 'package:flutter_app/bean/BlogBean.dart';
import 'package:flutter_app/controller/MenuController.dart';
import 'package:flutter_app/page/widget/LeftContentItemWidget.dart';
import 'package:get/get.dart';

class LeftContentWidget extends StatelessWidget {
  final MenuController _menuController = Get.put(MenuController());

  @override
  Widget build(BuildContext context) {
    return Obx(() {
      return buildListView();
    });
  }

  ListView buildListView() {
    //获取数据
    List list = _menuController.blogList;
    return ListView.builder(
        //禁止滑动
        physics: NeverScrollableScrollPhysics(),
        //包裹
        shrinkWrap: true,
        //子条目个数
        itemCount: list.length,
        //每个子Widget
        itemBuilder: (BuildContext context, int index) {
          //获取对应的数据
          BlogBean bean=list[index];
          return LeftContentItemWidget(bean);
        });
  }
}
